package com.oyc.demo.controller;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/")
public class PageController implements ApplicationContextAware{
	
	 private ApplicationContext context;
	
	/**
     * 欢迎界面
     * @return
     */
    @GetMapping({"/configureList"})
    public String configureList() {
    	return "configureList";
    }
    
    /**
     * 欢迎界面
     * @return
     */
    @GetMapping({"","/login"})
    public String login() {
    	return "login";
    }
    
    /**
     * 后端主页
     * @return
     */
    @GetMapping({"/statisticsList"})
    public String statisticsList() {
    	return "statisticsList";
    }
    
    /**
     * 前端主页
     * @return
     */
    @GetMapping({"/restdataclient"})
    public String restdataclient() {
    	return "restdataclient";
    }
    
    /**
     * 前端主页
     * @return
     */
    @GetMapping({"/restdata"})
    public String restdata() {
    	return "restdata";
    }
    
    /**
     * 前端主页
     * @return
     */
    @GetMapping({"/statistics"})
    public String statistics() {
    	return "statistics";
    }
    
    /**
     * 前端主页
     * @return
     */
    @GetMapping({"/uploadtable"})
    public String uploadtable() {
    	return "uploadtable";
    }
    
    /**
     * 前端主页
     * @return
     */
    @GetMapping({"/userlist"})
    public String userlist() {
    	return "userlist";
    }
    
    /**
     * 前端主页
     * @return
     */
    @GetMapping({"/close"})
    public String close() {
    	 ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) context;
         ctx.close();
    	return "close";
    }
    
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        context = applicationContext;
    }
    
}
